package com.jctrip.hotel.common.client;

import com.jctrip.hotel.common.client.model.DingTalkResult;
import com.jctrip.hotel.common.client.model.DingTalkTextParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 钉钉机器人通知
 */
@FeignClient(name = "DingTalkClient", url = "${feign.url.dingtalk}")
@RequestMapping(headers = {"accept=application/json"})
public interface DingTalkClient {

    String CREDIT_ALERT_TEMPLATE = "当前账户余额低于%s，请及时关注！";

    /**
     * 发送机器人消息（文本）
     */
    @GetMapping("/robot/send")
    DingTalkResult sendText(@RequestParam("access_token") String accessToken,
                            @RequestBody DingTalkTextParam dingTalkTextParam);
}
